package com.itheima.autoconfig;

import com.aliyun.oss.OSS;
import com.itheima.autoconfig.HuaWeiUGC.HuaWeiUGCProperties;
import com.itheima.autoconfig.HuaWeiUGC.HuaWeiUGCTemplate;
import com.itheima.autoconfig.HuanXin.HuanXinProperties;
import com.itheima.autoconfig.HuanXin.HuanXinTemplate;
import com.itheima.autoconfig.face.AipFaceProperties;
import com.itheima.autoconfig.face.AipFaceTemplate;
import com.itheima.autoconfig.oss.OssProperties;
import com.itheima.autoconfig.oss.OssTemplate;
import com.itheima.autoconfig.sms.SmsProperties;
import com.itheima.autoconfig.sms.SmsTemplate;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@EnableConfigurationProperties({
        SmsProperties.class,
        OssProperties.class,
        AipFaceProperties.class,
        HuanXinProperties.class,
        HuaWeiUGCProperties.class
})
//@ConditionalOnClass(OSS.class)
//@Import({SmsProperties.class})  //TODO ,注解与之前的不同
public class TanhuaAutoConfiguration {

    @Bean
    public SmsTemplate smsTemplate(SmsProperties smsProperties) {
        return new SmsTemplate(smsProperties);
    }

    @Bean
    public OssTemplate ossTemplate(OssProperties ossProperties) {
        return new OssTemplate(ossProperties);
    }

    @Bean
    public AipFaceTemplate aipFaceTemplate(AipFaceProperties aipFaceProperties) {
        return new AipFaceTemplate(aipFaceProperties);
    }

    @Bean
    public HuanXinTemplate huanXinTemplate(HuanXinProperties huanXinProperties) {
        return new HuanXinTemplate(huanXinProperties);
    }

    @Bean
    public HuaWeiUGCTemplate huaWeiTemplate(HuaWeiUGCProperties huaWeiUGCProperties){
        return new HuaWeiUGCTemplate(huaWeiUGCProperties);
    }
}
